#!/bin/bash

function print_usage {
    echo "Usage: $(basename "$0") <create | sync | help> [options]"
    echo
    echo " create   : Create new Subversion repository, import all files from ClearCase repository"
    echo "            to the created Subversion repository and generate svncc scripts and configs."
    echo " sync     : Synchronize repositories - export all changes from ClearCase to Subversion."
    echo " help     : Print this help."
}
    
if [[ $1 == help || $# == 0 ]]
then
      print_usage
      exit 0
fi

case "$1" in
    "create" | "sync") 
        SVNCC_HOME=$(cd "$(dirname "$0")"; pwd)
        COMMAND="$(basename "$0") $1"
        SCRIPT_PATH="$SVNCC_HOME/svncc-$1"
        shift
        ;;
     *) echo "Invalid command $1" 1>&2; print_usage; exit 1;;
 esac

. "$SCRIPT_PATH"
     